package com.lagou.service.impl;

import com.lagou.dao.ResumeDao;
import com.lagou.pojo.Resume;
import com.lagou.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;


    @Override
    public List<Resume> findAll(){

        return resumeDao.findAll();
    }


    @Override
    public int add(Resume resume){
        final Resume save = resumeDao.saveAndFlush(resume);

        if (null!=save){
            return 1;
        }

        return 0;
    }


    @Override
    public int update(Resume resume){

   return  add(resume);
    }


    @Override
    public int delete(Long id){

        resumeDao.delete(id);
        return 1;
    }

    @Override
    public Resume findById(Long id) {
        return resumeDao.findOne(id);
    }
}
